<?php
/**
 * Created by PhpStorm.
 * User: xiaofeng
 * motto: 现在的努力是为了小时候吹过的牛逼！
 * Date: 2020/1/6
 * Time: 18:47
 */

namespace app\common\model\mysql;

use think\Model;

class Demo extends Model{

    public function getDemoDataByCategoryId($categoryId, $limit = 10){

        if (empty($categoryId)){
            return [];
        }

        $result = $this->where("category_id",$categoryId)
            ->limit($limit)
            ->order("id","desc")
            ->select()
            ->toArray();
        return $result;
    }
}